package com.example.lvsuo.controller;


import com.example.lvsuo.entity.Client;
import com.example.lvsuo.entity.vo.ClientVo;
import com.example.lvsuo.modal.Result;
import com.example.lvsuo.service.IClientService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 * 客户表 前端控制器
 * </p>
 *
 * @author 心心念念
 * @since 2021-03-30
 */
@RestController
@RequestMapping("/client")
public class ClientController {

    @Autowired
    IClientService cs;

    @PostMapping
    Result addClient(@Valid ClientVo c){
        cs.addClient(c);
        return Result.back(cs.queryId());
    }

    @GetMapping
    Result queryClient(ClientVo c){

        System.err.println(c.getId());
        return Result.back(cs.seniorQuery(c));
    }
}

